#ifndef BROOT_FORCE_H
#define BROOT_FORCE_H

#include "modifier.h"
#include "event.h"
#include "graph.h"
#include "process_state.h"
#include "status_bar.h"
#include "checker.h"
#include <boost/ptr_container/ptr_vector.hpp>
#include <iostream>

typedef std::stack<std::pair<Event, int> > UndoStack;

class BrootForce
{
public:
    BrootForce(const IGraph* g,
               const IGraph* ng,
               size_t dist,
               std::vector<size_t> required = std::vector<size_t>())
        :state(g, ng, dist, required)
    {
        createCheckers();
        createModifiers();
        START_COLORING_GETTED = 4;
        successColored = unsuccessColored = 30;
    }

    void run()
    {
        run(0);
    }

    void run(size_t v);

    ~BrootForce()
    {
    }

private:
    size_t START_COLORING_GETTED;
    size_t successColored, unsuccessColored;
    bool processEvent(Event event, UndoStack& undoStack);
    bool processEventQueue(EventQueue& eventQueue, UndoStack& undoStack);
    bool processUndoStack(UndoStack& UndoStack);
    size_t runModifiers(Event event, size_t lastModifier, EventQueue& eventQueue);

    void createCheckers();
    void createModifiers();
    ProcessState state;
    boost::ptr_vector<IChecker> finalCheckers;
    boost::ptr_vector<IModifier> modifiers;
    StatusBar statusBar;
};

#endif//BROOT_FORCE_H
